import Page from '@/components/Page';
import Docs from '@/container/Docs';

import req from '@/utils/req';
import { GetServerSideProps, NextPage } from 'next';

const Index: NextPage<ResponseDocs> = ({ files = [] }) => {
  return (
    <Page>
      <Docs files={files} />
    </Page>
  );
};

export default Index;

export const getServerSideProps: GetServerSideProps = async (ctx) => {
  const res = await req.get<ResponseDocs>('/marked');

  return {
    props: {
      files: res,
    },
  };
};
